import { onMount } from 'svelte';

/** localeStorage等方法不能在服务端渲染时期使用，需要在挂载后去调用 */
export const useInMounted =
	<T = IObject>(fn: () => any): (() => { value: T }) =>
	() => {
		const info: any = {};

		onMount(() => {
			info.value = fn();
		});

		return info;
	};
